const userController = require('../controllers/user');
const Router = require('../lib/router');
const router = new Router();

/**
 * @swagger
 * @request('post', '/user/login')
 * @tags(['User'])
 * @summary('用户登录')
 * @body({
 *  username: "admin",
 *  password: "admin"
 * })
 * @response("登录成功", "200")
 * @response("参数验证失败", 501)
 */
router.post('/user/login', userController.login);
/**
 * @request('post', '/user/register')
 * @tags(['User'])
 * @summary("用户注册")
 * @body({
 *   username: "admin",
 *   password: "admin",
 *   phone: "string"
 * })
 */
router.post('/user/register', userController.register);
/**
 * @request('get', '/user/{id}')
 * @param({name: 'id', desc: '用户ID'})
 * @tags(['User'])
 */
router.get('/user/:id', userController.detail);

module.exports = router;